#include "../include/observer.h"
#include "../include/publisher.h"
#include <iostream>
#include <memory>

using namespace std;

void observer::doSubscribing()
{
    this->pub->addSubscriber(name, unique_ptr<observer>(this));
}

void observer::cancleSubscribing()
{
    this->pub->deleteSubscriber(name);
}

void observer::update()
{
    cout<<"I am "<<name<<", and I received publisher's notifying msg"<<endl;
}